package com.dz.risk.pojo.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.dz.risk.common.enums.ReportFormsTypeEnum;
import com.dz.risk.validation.Add;
import com.dz.risk.validation.Update;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 报表基本信息
 *
 * @author Doke
 * @date 2021-07-05 14:49:45
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Accessors(chain = true)
@ApiModel(value = "报表目录 : ReportFormsEntity")
@TableName("t_st_report_forms")
public class ReportFormsEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    public interface GenerateNewVersionReportForms{}

    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_ID)
    @NotBlank(message = "报表Id不能为空", groups = {GenerateNewVersionReportForms.class})
    @ApiModelProperty(value = "主键")
    private String id;

    /**
     * 报表编号
     */
    @NotNull(message = "报表编号不能为空", groups = {Add.class,GenerateNewVersionReportForms.class})
    @ApiModelProperty(value = "报表编号", required = true)
    private String reportFormsSerialNumber;

    /**
     * 报表名
     */
    @NotNull(message = "报表名不能为空", groups = {Add.class, Update.class,GenerateNewVersionReportForms.class})
    @ApiModelProperty(value = "报表名", required = true)
    private String reportFormsName;

    /**
     * 报表类别
     */
    @ApiModelProperty(value = "报表类别")
    private ReportFormsTypeEnum reportType;

    /**
     * 报表标题
     */
    @ApiModelProperty(value = "报表标题")
    private String reportFormsTitle;

    /**
     * 文件地址
     */
    @ApiModelProperty(value = "文件地址")
    private String fileAddress;

    /**
     * 是否作为版本内统一数据 : false 否，true 是
     */
    @ApiModelProperty(value = "是否作为版本内统一数据 : false 否，true 是")
    private Boolean rawData;

    /**
     * 开始时间
     */
    @ApiModelProperty(value = "开始时间(yyyy-MM-dd)")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "开始时间不能为空",groups = {GenerateNewVersionReportForms.class})
    private Date beginDate;

    /**
     * 结束时间
     */
    @ApiModelProperty(value = "结束时间(yyyy-MM-dd)")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "结束时间不能为空",groups = {GenerateNewVersionReportForms.class})
    private Date endDate;

    /**
     * 上级报表编号
     */
    @ApiModelProperty(value = "上级报表编号")
    @NotNull(message = "上级报表编号不能为空", groups = {Add.class,GenerateNewVersionReportForms.class})
    private String superiorReportFormsSerialNumber;

    /**
     * 排序号
     */
    @ApiModelProperty(value = "排序号")
    @NotNull(message = "排序号不能为空", groups = {Add.class, Update.class,GenerateNewVersionReportForms.class})
    private Integer queueNumber;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @TableField(fill = FieldFill.INSERT)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String createdUser;

    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String updatedUser;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Date createdTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Date updatedTime;

    /**
     * 是否删除：false 不删除，true 删除
     */
    @TableLogic(value = "false", delval = "true")
    @ApiModelProperty(value = "是否删除：false 不删除，true 删除")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean delFlag;

}
